## mako
<%page expression_filter="h"/>
<%namespace name='static' file='static_content.html'/>

<%!
from django.urls import reverse
from django.utils.translation import gettext as _

from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_urls_for_user
from openedx.features.enterprise_support.utils import get_enterprise_learner_generic_name
%>

<%
## This template should not use the target student's details when masquerading, see TNL-4895
self.real_user = getattr(user, 'real_user', user)
username = get_enterprise_learner_generic_name(request) or self.real_user.username
profile_image_url = get_profile_image_urls_for_user(self.real_user)['medium']
%>

% if uses_bootstrap:
    <div class="nav-item nav-item-hidden-collapsed container">
        <div class="nav align-items-center">
            <a class="menu-title mr-2" href="${reverse('dashboard')}">
                <span class="sr-only">${_("Dashboard for:")}</span>
                <img data-hj-suppress class="user-image-frame" src="${profile_image_url}" alt="${username}">
            </a>
            <div class="dropdown">
                <a data-hj-suppress class="dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">${username}</a>
                <ul role="menu" class="dropdown-menu dropdown-menu-right" id="${_("Usermenu")}" aria-labelledby="dropdownMenuLink" tabindex="-1">
                    <li role="presentation"><a role="menuitem" class="dropdown-item" href="${reverse('dashboard')}">${_("Dashboard")}</a></li>
                    <li role="presentation"><a role="menuitem" class="dropdown-item" href="${settings.ACCOUNT_MICROFRONTEND_URL}">${_("Account")}</a></li>
                    <li role="presentation"><a role="menuitem" class="dropdown-item" href="${reverse('logout')}">${_("Sign Out")}</a></li>
                </ul>
            </div>
        </div>
    </div>
    <ul role="menu" class="nav flex-column align-items-center">
        <li role="presentation" class="nav-item nav-item-open-collapsed-only collapse"><a role="menuitem" href="${reverse('dashboard')}">${_("Dashboard")}</a></li>
        <li role="presentation" class="nav-item nav-item-open-collapsed-only"><a role="menuitem" href="${settings.ACCOUNT_MICROFRONTEND_URL}">${_("Account")}</a></li>
        <li role="presentation" class="nav-item nav-item-open-collapsed-only"><a role="menuitem" href="${reverse('logout')}">${_("Sign Out")}</a></li>
    </ul>
% else:
    <ol class="user">
        <li class="primary">
            <a href="${reverse('dashboard')}" class="user-link">
                <span class="sr">${_("Dashboard for:")}</span>
                <img class="user-image-frame" src="${profile_image_url}" alt="">
                <div data-hj-suppress class="label-username">${username}</div>
            </a>
        </li>
        <li class="primary">
            <div class="user-menu">
                <button class="user-dropdown" aria-expanded="false" aria-haspopup="true">
                    <span class="sr">${_("More options")}</span>
                    <span class="fa fa-sort-desc" aria-hidden="true"></span>
                </button>
                <ul class="user-dropdown-menu" aria-label=${_("More Options")} role="menu">
                    ${navigation_dropdown_menu_links()}
                    <li class="item"><a href="${reverse('logout')}" role="menuitem" class="user-dropdown-menuitem">${_("Sign Out")}</a></li>
                </ul>
            </div>
        </li>
    </ol>
% endif
